Skip to content

Conversation

hardillb
Copy link
Contributor

@hardillb hardillb commented Oct 8, 2025

part of #3642

Description

This adds a new caches component to the app object. It can be backed by in memory objects or a remote Redis/Valkey instance to allow sharing between multiple instances of the Forge App.

  • app.caches.initCache() used to set backend up

  • app.caches.getCache(name) used to create/retrieve a cache instance with a given name

  • cache.get(key) gets a value for a key

  • cache.set(key, value) sets a value for key

  • cache.del(key) removes a key

  • cache.keys() array of all keys

  • cache.all() object with all key value pairs in the cache instance

Needs tests

Related Issue(s)

#3642

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production
  • Link to Changelog Entry PR, or note why one is not needed.

Labels

  • Includes a DB migration? -> add the area:migration label

Copy link

codecov bot commented Oct 8, 2025

Codecov Report

❌ Patch coverage is 60.40268% with 59 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.71%. Comparing base (9bc8ebc) to head (5ff472e).

Files with missing lines Patch % Lines
forge/caches/redis-cache.js 0.00% 34 Missing ⚠️
forge/routes/api/projectActions.js 31.81% 15 Missing ⚠️
forge/ee/routes/customHostnames/index.js 0.00% 3 Missing ⚠️
forge/caches/index.js 86.66% 2 Missing ⚠️
forge/ee/routes/ha/index.js 50.00% 2 Missing ⚠️
forge/db/models/Project.js 83.33% 1 Missing ⚠️
forge/ee/db/controllers/Pipeline.js 75.00% 1 Missing ⚠️
forge/ee/lib/billing/trialTask.js 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6115      +/-   ##
==========================================
- Coverage   76.81%   76.71%   -0.10%     
==========================================
  Files         381      384       +3     
  Lines       19290    19363      +73     
  Branches     4646     4651       +5     
==========================================
+ Hits        14817    14854      +37     
- Misses       4473     4509      +36     
Flag Coverage Δ
backend 76.71% <60.40%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

And ensure `undefined` returned not `null`
@hardillb hardillb marked this pull request as ready for review October 10, 2025 12:50
@hardillb hardillb marked this pull request as draft October 13, 2025 10:47
@hardillb hardillb self-assigned this Oct 13, 2025
@hardillb hardillb marked this pull request as ready for review October 13, 2025 13:58
@hardillb
Copy link
Contributor Author

Test coverage looks strange as it contains files I've not touched.

Also still getting the odd UI RBAC test failures that again should be unrelated.

Tests are all running with the memory cache, not redis/valkey, but we should be able to enable valkey in the test suite

@hardillb
Copy link
Contributor Author

To test run

docker run --rm -p 6379:6379 --name valkey valkey/valkey

And add to end of flowfuse.local.yaml

ache:
  driver: 'redis'
  options:
    url: redis://localhost:6379

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants